﻿Public Class LoginForm 

    Private Sub linkOptions_OpenLink(sender As System.Object, e As DevExpress.XtraEditors.Controls.OpenLinkEventArgs) Handles linkOptions.OpenLink
        Dim frm As OptionsForm = New OptionsForm()
        frm.ShowDialog()
    End Sub

    Private Sub btnServerList_Click(sender As System.Object, e As System.EventArgs) Handles btnServerList.Click
        Dim frm As ServerManagerForm = New ServerManagerForm()
        frm.ShowDialog()
    End Sub


    Private Sub LoginForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        
    End Sub

    Private Sub lookupServer_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles lookupServer.ButtonClick
        PopulateServerList(True)
    End Sub


    Private Sub PopulateServerList(ByVal refresh As Boolean)
        Dim servers As ArrayList = Nothing
        Dim previousCursor As Cursor = Me.Cursor
        Me.Cursor = Cursors.WaitCursor

        If refresh Or servers Is Nothing Then
            servers = CommonExt.Utils.SMOExt.GetServerList(refresh)
        End If

        'cboServer.Items.Clear()

        If servers Is Nothing Then
            'cboServer.Text = CST_ERRORFINDINGSERVERS_MSG
        Else
            If servers.Count = 0 Then
                'cboServer.Text = CST_NOSERVERFOUND_MSG
            ElseIf servers.Count > 0 Then
                For Each serverName As String In servers
                    'cboServer.Items.Add(serverName)
                    'cboServer.Enabled = True
                Next
                'cboServer.SelectedIndex = 0
            End If
        End If

        Me.Cursor = previousCursor

    End Sub
End Class